Skip to content

Add animation effect to ajax response #886

Closed Answered by juliangarnier
amirehsan1370 asked this question in Q&A
Discussion options

You must be logged in to vote

You need a way to only target the new added elements.
Maybe something like this:

// Store the count of existing items before adding new ones
const existingCount = $('.loadMoreRepeat').length;

// Insert the new content

// Select only the newly added items
const newItems = $('.loadMoreRepeat').slice(existingCount);

// Animate only the new items (v4 syntax)
animate(newItems, {
  scale: [.5, 1]
});

Closing for now but feel free to re-open if it doesn't answer your question.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by juliangarnier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants